package com.shrct.businessprocess.project.impl;

import com.shrct.businessprocess.budget.RCBudget;
import com.shrct.businessprocess.budget.impl.RCBudgetImpl;
import com.shrct.businessprocess.project.RCActualCostReportItem;
import com.shrct.businessprocess.project.RCCost4ACTItemSnap;
import com.shrct.businessprocess.project.impl.RCActualCostReportItemImpl;
import com.shrct.businessprocess.project.proxy.RCCost4ACTItemSnapProxy;
import edu.fudan.mylang.pf.BaseModelObject;
import edu.fudan.mylang.pf.IObjectFactory;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.hibernate.annotations.DiscriminatorOptions;

@Entity
@DiscriminatorValue("RCCOST4ACTITEMSNAP_TYPE")
@DiscriminatorOptions(force = true)
@DiscriminatorColumn(length = 64)
@Table(name = "rccost4actitemsnap")
public class RCCost4ACTItemSnapImpl extends BaseModelObject implements RCCost4ACTItemSnap {
  public RCCost4ACTItemSnapImpl() {
    super();
  }
  
  public RCCost4ACTItemSnapImpl(final RCActualCostReportItem reportItem) {
    super();
    this.reportItem = reportItem;
  }
  
  @JoinColumn(name = "reportItem_id")
  @ManyToOne(targetEntity = RCActualCostReportItemImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private RCActualCostReportItem reportItem;
  
  public RCActualCostReportItem getReportItem() {
    return this.reportItem;
  }
  
  public RCCost4ACTItemSnap setReportItem(final RCActualCostReportItem reportItem) {
    this.reportItem = reportItem;
    return this;			
    
  }
  
  @JoinColumn(name = "budget_id")
  @ManyToOne(targetEntity = RCBudgetImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private RCBudget budget;
  
  public RCBudget getBudget() {
    return this.budget;
  }
  
  public RCCost4ACTItemSnap setBudget(final RCBudget budget) {
    this.budget = budget;
    return this;			
    
  }
  
  private String title;
  
  public String getTitle() {
    return this.title;
  }
  
  public RCCost4ACTItemSnap setTitle(final String title) {
    this.title = title;
    return this;			
    
  }
  
  private Date date;
  
  public Date getDate() {
    return this.date;
  }
  
  public RCCost4ACTItemSnap setDate(final Date date) {
    this.date = date;
    return this;			
    
  }
  
  private Double amount;
  
  public Double getAmount() {
    return this.amount;
  }
  
  public RCCost4ACTItemSnap setAmount(final Double amount) {
    this.amount = amount;
    return this;			
    
  }
  
  private Double taxRate;
  
  public Double getTaxRate() {
    return this.taxRate;
  }
  
  public RCCost4ACTItemSnap setTaxRate(final Double taxRate) {
    this.taxRate = taxRate;
    return this;			
    
  }
  
  public static RCCost4ACTItemSnap create(final RCActualCostReportItem reportItem, final IObjectFactory objectFactory) {
    com.shrct.businessprocess.project.RCCost4ACTItemSnap rCCost4ACTItemSnap = new com.shrct.businessprocess.project.impl.RCCost4ACTItemSnapImpl(
    	reportItem
    );
    objectFactory.create(rCCost4ACTItemSnap);
    return rCCost4ACTItemSnap;			
    
  }
  
  public static RCCost4ACTItemSnap createRCCost4ACTItemSnapImpl(final RCActualCostReportItem reportItem, final IObjectFactory objectFactory, final Procedure1<RCCost4ACTItemSnap> init) {
    com.shrct.businessprocess.project.RCCost4ACTItemSnap rCCost4ACTItemSnap = new com.shrct.businessprocess.project.impl.RCCost4ACTItemSnapImpl(
    	reportItem
    );
    objectFactory.create(rCCost4ACTItemSnap);
    init.apply(rCCost4ACTItemSnap);
    
    return rCCost4ACTItemSnap;			
    
  }
  
  public RCCost4ACTItemSnapProxy toProxy() {
    com.shrct.businessprocess.project.proxy.RCCost4ACTItemSnapProxy proxy = new com.shrct.businessprocess.project.proxy.RCCost4ACTItemSnapProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
